# Importing Data
TAJIKISTAN<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AF1:AF229")

# Checking the Imported Data
View(TAJIKISTAN)
# Creating Time Series Data
TAJIKISTAN_ts <- ts(TAJIKISTAN, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
TAJIKISTAN_ts
sum(is.na(TAJIKISTAN_ts))
library(forecast)
TAJIKISTAN_ts <- tsclean(TAJIKISTAN_ts)
TAJIKISTAN_ts

# Identification: Plotting the Time Series Data
plot(TAJIKISTAN_ts)

# Estimating the appropriate model
TAJIKISTAN_ts_model <- auto.arima(TAJIKISTAN_ts)
TAJIKISTAN_ts_model

# Forecasting
options(max.print=1000000)
TAJIKISTAN_ts_forecast <- forecast (TAJIKISTAN_ts_model, level=c(95), h=288)
plot(TAJIKISTAN_ts_forecast)
TAJIKISTAN_ts_forecast             

# Exporting
write.table(TAJIKISTAN_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/TAJIKISTAN_TSA.csv", sep=",")
